import { _decorator, Component, Contact2DType, Collider2D, PhysicsSystem2D } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('bullet')
export class bullet extends Component {
	@property
	speed:number = 800
    start() {
		
		
    }
	
    update(deltaTime: number) {
		if(this.node!==null){
			this.node.setPosition(
				this.node.getPosition().x, this.node.getPosition().y + this.speed * deltaTime
			)
			if (this.node.getPosition().y > 400) {
				this.node.destroy()
			}
		}
    }
	miss() {
		try {
			this.node?.destroy();
		} catch (e) {
			// ..
		}
	}
}

